At present, memory structures of parallel computers are generally classified into a shared memory structure and a distributed memory structure. In the shared memory structure, all processors have a global physical memory that is accessed uniformly, and a programming model of a global shared variable is supported. Its programming is simple, but expansibility is poor due to limitations such as a shared memory bandwidth. In the distributed memory structure, many independent computing nodes having local memories are interconnected through a high speed network, and each computing node has an independent address space. Communication between tasks executed by computing node is implemented through transferring an explicit message between the computing nodes. A task is a basic unit for resource allocation and scheduling execution in a system, and includes data and an operation sequence of the data. Multiple tasks may coordinate with each other and be executed concurrently, thereby jointly implementing a specific function. Expansibility of the distributed memory structure is good; however, its program design is difficult because data allocation and message transfer need to be taken into consideration.
A DSM (Distributed Shared Memory) structure implements logical shared memory through hardware or software in a system with scattered physical memories. In a DSM, especially in a DSM implemented through software, an underlying message transfer mechanism is covered up from a user, and the user is allowed to perform parallel program designing in a shared memory manner. A distributed shared memory system not only has an advantage of being easy to program as a shared memory system, but also maintains extensibility of a distributed memory system, and therefore the distributed shared memory system is an important form of a large-scale parallel computing system. In the DSM system, when a specific function jointly implemented by multiple tasks (for example, multiple processes or threads) exists, and the tasks have a restrictive sequence relationship and are required to follow a certain sequence constraint, execution of the tasks needs to be cooperated. Therefore, how to implement cooperation of tasks is a key problem that needs to be solved in parallel program design.
In the prior art, cooperation means such as a lock, a semaphore, and a monitor are only applicable to a single-machine environment having a common memory area. In a barrier cooperation method based on a message transfer programming mode in the prior art, a barrier point is disposed at a position where tasks should wait for each other in a program of each task participating in barrier cooperation. A certain task pauses when proceeding to the barrier point, and the task may continue running after all the tasks proceed to the barrier point. Explicit message transfer programming requires a programmer to pay attention to data division and communication between tasks, and therefore, a lot of efforts are expended on solving data dependency and on deadlock prevention. As a result, an error is likely to occur.